using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;

public partial class forums_controls_threads_LastThread : Controls.DataManagerThreadControl
{
    protected override void ItemChanged()
    {
        if (CurrentThread != null)
        {
            mviewThread.SetActiveView(viewThread);
            lnkThread.Text = Helpers.StringHelper.SafeFormat(CurrentThread.FirstPost.Subject);
            lnkThread.NavigateUrl = Helpers.StringHelper.SafeFormat("~/forums/thread.aspx?p={0}#{0}", CurrentThread.LastPost.ID);

            lnkUser.Text = Helpers.StringHelper.SafeFormat(CurrentThread.LastPost.User.Username);
            lnkUser.NavigateUrl = Helpers.StringHelper.SafeFormat("~/forums/profile.aspx?u={0}", CurrentThread.LastPost.User.ID);

            lblDate.Text = CurrentItem.LastPost.DatePosted.ToString("yyyy-MMM-dd hh:mm tt");
        }
        else
        {
            mviewThread.SetActiveView(viewNone);
        }
    }
}
